<template>
    <Form ref="formData" :model="formData" :rules="ruleValidate" :label-width="80">
        <FormItem label="字典编码" prop="typeCode">
            <Input v-model="formData.typeCode" disabled></Input>
        </FormItem>
        <FormItem label="数据项值" prop="value">
            <Input v-model="formData.value"></Input>
        </FormItem>
        <FormItem label="数据项名称" prop="name">
            <Input v-model="formData.name" ></Input>
        </FormItem>
        <FormItem label="排序号" prop="sortNo">
            <Input v-model="formData.sortNo" ></Input>
        </FormItem>
        <div style="text-align: center;margin: 15px">
            <Button @click="handleReset('formData')">重置</Button>
            <Button type="primary" @click="handleSubmit('formData')" style="margin-left: 8px">保存</Button>
        </div>
        <!--加载中显示 -->
        <Spin size="large" fix v-if="spinShow"></Spin>
    </Form>
</template>

<script>
    import Base from '@/components/table/BaseEdit.vue';
    export default {
        extends:Base,
        data () {
            return {
                ruleValidate: {
                    typeCode: [
                        { required: true, message: '请输入字典编码!', trigger: 'blur' },
                    ],
                    value: [
                        { required: true, message: '请输入数据项值!', trigger: 'blur' },
                    ],
                    name: [
                        { required: true, message: '请输入数据项名称!', trigger: 'blur' },
                    ],
                }
            }
        },
        methods: {
            loadDataById(id){
                this.load("/api/system/dict/entity/read",{id})
            },handleSubmit (name) {
                //保存
                this.save(name,"/api/system/dict/entity/save");
            },loadDataByTypeCode(typeCode){
                this.handleReset('formData');
                this.formData={typeCode};
            }
        }
    }
</script>

<style scoped>

</style>
